package com.blockmeta.bbs.baselibrary.runtime.mvvm

import android.os.Bundle
import androidx.lifecycle.LifecycleOwner
import com.blockmeta.bbs.baselibrary.runtime.IArchVM
import com.blockmeta.bbs.baselibrary.runtime.IArchView
import com.blockmeta.bbs.baselibrary.runtime.base.Btc8Fragment

/**
 * @CreateDate:   2020-07-14 16:44
 * @Author:       Lewis Weng
 * @Description:
 */
abstract class MVVMFragment<VM : IArchVM> : Btc8Fragment(), IArchView<VM> {
    var mViewModel: VM? = null


    override fun onActivityCreatedInner(savedInstanceState: Bundle?) {
        super.onActivityCreatedInner(savedInstanceState)
        mViewModel = initViewModel()
        vmObserver(viewLifecycleOwner)
    }

    open fun vmObserver(owner: LifecycleOwner) {}

}